﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using System;


namespace XLua
{
    public static partial class CopyByValue
    {
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Vector2 val)
		{
		    val = new UnityEngine.Vector2();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "x"))
            {
			    
                translator.Get(L, top + 1, out val.x);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "y"))
            {
			    
                translator.Get(L, top + 1, out val.y);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Vector2 field)
        {
            
            if(!LuaAPI.xlua_pack_float2(buff, offset, field.x, field.y))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Vector2 field)
        {
            field = default(UnityEngine.Vector2);
            
            float x = default(float);
            float y = default(float);
            
            if(!LuaAPI.xlua_unpack_float2(buff, offset, out x, out y))
            {
                return false;
            }
            field.x = x;
            field.y = y;
            
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Vector3 val)
		{
		    val = new UnityEngine.Vector3();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "x"))
            {
			    
                translator.Get(L, top + 1, out val.x);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "y"))
            {
			    
                translator.Get(L, top + 1, out val.y);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "z"))
            {
			    
                translator.Get(L, top + 1, out val.z);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Vector3 field)
        {
            
            if(!LuaAPI.xlua_pack_float3(buff, offset, field.x, field.y, field.z))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Vector3 field)
        {
            field = default(UnityEngine.Vector3);
            
            float x = default(float);
            float y = default(float);
            float z = default(float);
            
            if(!LuaAPI.xlua_unpack_float3(buff, offset, out x, out y, out z))
            {
                return false;
            }
            field.x = x;
            field.y = y;
            field.z = z;
            
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Vector4 val)
		{
		    val = new UnityEngine.Vector4();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "x"))
            {
			    
                translator.Get(L, top + 1, out val.x);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "y"))
            {
			    
                translator.Get(L, top + 1, out val.y);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "z"))
            {
			    
                translator.Get(L, top + 1, out val.z);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "w"))
            {
			    
                translator.Get(L, top + 1, out val.w);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Vector4 field)
        {
            
            if(!LuaAPI.xlua_pack_float4(buff, offset, field.x, field.y, field.z, field.w))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Vector4 field)
        {
            field = default(UnityEngine.Vector4);
            
            float x = default(float);
            float y = default(float);
            float z = default(float);
            float w = default(float);
            
            if(!LuaAPI.xlua_unpack_float4(buff, offset, out x, out y, out z, out w))
            {
                return false;
            }
            field.x = x;
            field.y = y;
            field.z = z;
            field.w = w;
            
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Color val)
		{
		    val = new UnityEngine.Color();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "r"))
            {
			    
                translator.Get(L, top + 1, out val.r);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "g"))
            {
			    
                translator.Get(L, top + 1, out val.g);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "b"))
            {
			    
                translator.Get(L, top + 1, out val.b);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "a"))
            {
			    
                translator.Get(L, top + 1, out val.a);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Color field)
        {
            
            if(!LuaAPI.xlua_pack_float4(buff, offset, field.r, field.g, field.b, field.a))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Color field)
        {
            field = default(UnityEngine.Color);
            
            float r = default(float);
            float g = default(float);
            float b = default(float);
            float a = default(float);
            
            if(!LuaAPI.xlua_unpack_float4(buff, offset, out r, out g, out b, out a))
            {
                return false;
            }
            field.r = r;
            field.g = g;
            field.b = b;
            field.a = a;
            
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Quaternion val)
		{
		    val = new UnityEngine.Quaternion();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "x"))
            {
			    
                translator.Get(L, top + 1, out val.x);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "y"))
            {
			    
                translator.Get(L, top + 1, out val.y);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "z"))
            {
			    
                translator.Get(L, top + 1, out val.z);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "w"))
            {
			    
                translator.Get(L, top + 1, out val.w);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Quaternion field)
        {
            
            if(!LuaAPI.xlua_pack_float4(buff, offset, field.x, field.y, field.z, field.w))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Quaternion field)
        {
            field = default(UnityEngine.Quaternion);
            
            float x = default(float);
            float y = default(float);
            float z = default(float);
            float w = default(float);
            
            if(!LuaAPI.xlua_unpack_float4(buff, offset, out x, out y, out z, out w))
            {
                return false;
            }
            field.x = x;
            field.y = y;
            field.z = z;
            field.w = w;
            
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Ray val)
		{
		    val = new UnityEngine.Ray();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "origin"))
            {
			    
				var origin = val.origin;
				translator.Get(L, top + 1, out origin);
				val.origin = origin;
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "direction"))
            {
			    
				var direction = val.direction;
				translator.Get(L, top + 1, out direction);
				val.direction = direction;
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Ray field)
        {
            
            if(!Pack(buff, offset, field.origin))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 12, field.direction))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Ray field)
        {
            field = default(UnityEngine.Ray);
            
            var origin = field.origin;
            if(!UnPack(buff, offset, out origin))
            {
                return false;
            }
            field.origin = origin;
            
            var direction = field.direction;
            if(!UnPack(buff, offset + 12, out direction))
            {
                return false;
            }
            field.direction = direction;
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Bounds val)
		{
		    val = new UnityEngine.Bounds();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "center"))
            {
			    
				var center = val.center;
				translator.Get(L, top + 1, out center);
				val.center = center;
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "extents"))
            {
			    
				var extents = val.extents;
				translator.Get(L, top + 1, out extents);
				val.extents = extents;
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Bounds field)
        {
            
            if(!Pack(buff, offset, field.center))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 12, field.extents))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Bounds field)
        {
            field = default(UnityEngine.Bounds);
            
            var center = field.center;
            if(!UnPack(buff, offset, out center))
            {
                return false;
            }
            field.center = center;
            
            var extents = field.extents;
            if(!UnPack(buff, offset + 12, out extents))
            {
                return false;
            }
            field.extents = extents;
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Ray2D val)
		{
		    val = new UnityEngine.Ray2D();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "origin"))
            {
			    
				var origin = val.origin;
				translator.Get(L, top + 1, out origin);
				val.origin = origin;
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "direction"))
            {
			    
				var direction = val.direction;
				translator.Get(L, top + 1, out direction);
				val.direction = direction;
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Ray2D field)
        {
            
            if(!Pack(buff, offset, field.origin))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 8, field.direction))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Ray2D field)
        {
            field = default(UnityEngine.Ray2D);
            
            var origin = field.origin;
            if(!UnPack(buff, offset, out origin))
            {
                return false;
            }
            field.origin = origin;
            
            var direction = field.direction;
            if(!UnPack(buff, offset + 8, out direction))
            {
                return false;
            }
            field.direction = direction;
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.UpdateSoldierStruct val)
		{
		    val = new Yoozoo.Gameplay.RTS.UpdateSoldierStruct();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "Tid"))
            {
			    
                translator.Get(L, top + 1, out val.Tid);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "SoldierCount"))
            {
			    
                translator.Get(L, top + 1, out val.SoldierCount);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "InitSoldierCount"))
            {
			    
                translator.Get(L, top + 1, out val.InitSoldierCount);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "Type"))
            {
			    
                translator.Get(L, top + 1, out val.Type);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.UpdateSoldierStruct field)
        {
            
            if(!Pack(buff, offset, field.Tid))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 8, field.SoldierCount))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 12, field.InitSoldierCount))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 16, field.Type))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.UpdateSoldierStruct field)
        {
            field = default(Yoozoo.Gameplay.RTS.UpdateSoldierStruct);
            
            if(!UnPack(buff, offset, out field.Tid))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 8, out field.SoldierCount))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 12, out field.InitSoldierCount))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 16, out field.Type))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.CastSkill val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.CastSkill();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "skillId"))
            {
			    
                translator.Get(L, top + 1, out val.skillId);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "skillLv"))
            {
			    
                translator.Get(L, top + 1, out val.skillLv);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "targetId"))
            {
			    
                translator.Get(L, top + 1, out val.targetId);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "heroId"))
            {
			    
                translator.Get(L, top + 1, out val.heroId);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.CastSkill field)
        {
            
            if(!Pack(buff, offset, field.skillId))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 4, field.skillLv))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 8, field.targetId))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 16, field.heroId))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.CastSkill field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.CastSkill);
            
            if(!UnPack(buff, offset, out field.skillId))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 4, out field.skillLv))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 8, out field.targetId))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 16, out field.heroId))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.Coordinate val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.Coordinate();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "xAxis"))
            {
			    
                translator.Get(L, top + 1, out val.xAxis);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "zAxis"))
            {
			    
                translator.Get(L, top + 1, out val.zAxis);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.Coordinate field)
        {
            
            if(!LuaAPI.xlua_pack_float2(buff, offset, field.xAxis, field.zAxis))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.Coordinate field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.Coordinate);
            
            float xAxis = default(float);
            float zAxis = default(float);
            
            if(!LuaAPI.xlua_unpack_float2(buff, offset, out xAxis, out zAxis))
            {
                return false;
            }
            field.xAxis = xAxis;
            field.zAxis = zAxis;
            
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.CrossingGate val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.CrossingGate();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "start"))
            {
			    
                translator.Get(L, top + 1, out val.start);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "end"))
            {
			    
                translator.Get(L, top + 1, out val.end);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "startTime"))
            {
			    
                translator.Get(L, top + 1, out val.startTime);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.CrossingGate field)
        {
            
            if(!Pack(buff, offset, field.start))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 8, field.end))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 16, field.startTime))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.CrossingGate field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.CrossingGate);
            
            if(!UnPack(buff, offset, out field.start))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 8, out field.end))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 16, out field.startTime))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.SoldierLocation val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.SoldierLocation();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "id"))
            {
			    
                translator.Get(L, top + 1, out val.id);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "pos"))
            {
			    
                translator.Get(L, top + 1, out val.pos);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "scale"))
            {
			    
                translator.Get(L, top + 1, out val.scale);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.SoldierLocation field)
        {
            
            if(!Pack(buff, offset, field.id))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 4, field.pos))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 16, field.scale))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.SoldierLocation field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.SoldierLocation);
            
            if(!UnPack(buff, offset, out field.id))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 4, out field.pos))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 16, out field.scale))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.ElementResult val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.ElementResult();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "amount"))
            {
			    
                translator.Get(L, top + 1, out val.amount);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "sourceMarch"))
            {
			    
                translator.Get(L, top + 1, out val.sourceMarch);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "castPlayerId"))
            {
			    
                translator.Get(L, top + 1, out val.castPlayerId);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.ElementResult field)
        {
            
            if(!Pack(buff, offset, field.amount))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 4, field.sourceMarch))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 12, field.castPlayerId))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.ElementResult field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.ElementResult);
            
            if(!UnPack(buff, offset, out field.amount))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 4, out field.sourceMarch))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 12, out field.castPlayerId))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL2 val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL2();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "expireTime"))
            {
			    
                translator.Get(L, top + 1, out val.expireTime);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL2 field)
        {
            
            if(!Pack(buff, offset, field.expireTime))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL2 field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL2);
            
            if(!UnPack(buff, offset, out field.expireTime))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL4 val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL4();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "uid"))
            {
			    
                translator.Get(L, top + 1, out val.uid);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "coordinate"))
            {
			    
                translator.Get(L, top + 1, out val.coordinate);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "buildingId"))
            {
			    
                translator.Get(L, top + 1, out val.buildingId);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL4 field)
        {
            
            if(!Pack(buff, offset, field.uid))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 8, field.coordinate))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 16, field.buildingId))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL4 field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.MapPoliceOfficeL4);
            
            if(!UnPack(buff, offset, out field.uid))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 8, out field.coordinate))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 16, out field.buildingId))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.RTS.Proto.TroopsSoldier val)
		{
		    val = new Yoozoo.Gameplay.RTS.Proto.TroopsSoldier();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "soldierId"))
            {
			    
                translator.Get(L, top + 1, out val.soldierId);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "initNum"))
            {
			    
                translator.Get(L, top + 1, out val.initNum);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "curNum"))
            {
			    
                translator.Get(L, top + 1, out val.curNum);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "soldierType"))
            {
			    
                translator.Get(L, top + 1, out val.soldierType);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "attackRange"))
            {
			    
                translator.Get(L, top + 1, out val.attackRange);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.RTS.Proto.TroopsSoldier field)
        {
            
            if(!Pack(buff, offset, field.soldierId))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 4, field.initNum))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 8, field.curNum))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 12, field.soldierType))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 16, field.attackRange))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.RTS.Proto.TroopsSoldier field)
        {
            field = default(Yoozoo.Gameplay.RTS.Proto.TroopsSoldier);
            
            if(!UnPack(buff, offset, out field.soldierId))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 4, out field.initNum))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 8, out field.curNum))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 12, out field.soldierType))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 16, out field.attackRange))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.City.CityRealAiSpecialRecoverConfig val)
		{
		    val = new Yoozoo.Gameplay.City.CityRealAiSpecialRecoverConfig();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "id"))
            {
			    
                translator.Get(L, top + 1, out val.id);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "recover_tree"))
            {
			    
                translator.Get(L, top + 1, out val.recover_tree);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.City.CityRealAiSpecialRecoverConfig field)
        {
            
            if(!Pack(buff, offset, field.id))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 4, field.recover_tree))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.City.CityRealAiSpecialRecoverConfig field)
        {
            field = default(Yoozoo.Gameplay.City.CityRealAiSpecialRecoverConfig);
            
            if(!UnPack(buff, offset, out field.id))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 4, out field.recover_tree))
            {
                return false;
            }
            
            return true;
        }
        
		
		public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Yoozoo.Gameplay.City.GlobalVariablesConfig val)
		{
		    val = new Yoozoo.Gameplay.City.GlobalVariablesConfig();
            int top = LuaAPI.lua_gettop(L);
			
			if (Utils.LoadField(L, idx, "cityRealAiTimeRange"))
            {
			    
                translator.Get(L, top + 1, out val.cityRealAiTimeRange);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "cityRealAiTimeRandom"))
            {
			    
                translator.Get(L, top + 1, out val.cityRealAiTimeRandom);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "cityRealAiTimeStep"))
            {
			    
                translator.Get(L, top + 1, out val.cityRealAiTimeStep);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "cityRealAiOutCityTimeRange"))
            {
			    
                translator.Get(L, top + 1, out val.cityRealAiOutCityTimeRange);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "cityRealAiOutCityTimeRandom"))
            {
			    
                translator.Get(L, top + 1, out val.cityRealAiOutCityTimeRandom);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "cityRealAiOutCityTimeStep"))
            {
			    
                translator.Get(L, top + 1, out val.cityRealAiOutCityTimeStep);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_buswait_time_default"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_buswait_time_default);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_downcar_num_limit"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_downcar_num_limit);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_bushidetime_num_limit"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_bushidetime_num_limit);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_incity_time"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_incity_time);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_outcity_time"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_outcity_time);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_npcnum_buscallnow"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_npcnum_buscallnow);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_starttodownpoint_time"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_starttodownpoint_time);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "incity_npc_ai_downtouppoint_time"))
            {
			    
                translator.Get(L, top + 1, out val.incity_npc_ai_downtouppoint_time);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_rubbish_pertime"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_rubbish_pertime);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_rubbish_limit"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_rubbish_limit);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_rubbish_trigger_basepro"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_rubbish_trigger_basepro);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_dispute_pertime"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_dispute_pertime);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_dispute_trigger_basepro"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_dispute_trigger_basepro);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_fix_pertime"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_fix_pertime);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_fix_limit"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_fix_limit);
				
            }
            LuaAPI.lua_pop(L, 1);
			
			if (Utils.LoadField(L, idx, "city_operate_fix_trigger_basepro"))
            {
			    
                translator.Get(L, top + 1, out val.city_operate_fix_trigger_basepro);
				
            }
            LuaAPI.lua_pop(L, 1);
			
		}
		
        public static bool Pack(IntPtr buff, int offset, Yoozoo.Gameplay.City.GlobalVariablesConfig field)
        {
            
            if(!Pack(buff, offset, field.cityRealAiTimeRange))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 4, field.cityRealAiTimeRandom))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 8, field.cityRealAiTimeStep))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 12, field.cityRealAiOutCityTimeRange))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 16, field.cityRealAiOutCityTimeRandom))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 20, field.cityRealAiOutCityTimeStep))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 24, field.incity_npc_ai_buswait_time_default))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 28, field.incity_npc_ai_downcar_num_limit))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 32, field.incity_npc_ai_bushidetime_num_limit))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 36, field.incity_npc_ai_incity_time))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 40, field.incity_npc_ai_outcity_time))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 44, field.incity_npc_ai_npcnum_buscallnow))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 48, field.incity_npc_ai_starttodownpoint_time))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 52, field.incity_npc_ai_downtouppoint_time))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 56, field.city_operate_rubbish_pertime))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 60, field.city_operate_rubbish_limit))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 64, field.city_operate_rubbish_trigger_basepro))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 68, field.city_operate_dispute_pertime))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 72, field.city_operate_dispute_trigger_basepro))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 76, field.city_operate_fix_pertime))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 80, field.city_operate_fix_limit))
            {
                return false;
            }
            
            if(!Pack(buff, offset + 84, field.city_operate_fix_trigger_basepro))
            {
                return false;
            }
            
            return true;
        }
        public static bool UnPack(IntPtr buff, int offset, out Yoozoo.Gameplay.City.GlobalVariablesConfig field)
        {
            field = default(Yoozoo.Gameplay.City.GlobalVariablesConfig);
            
            if(!UnPack(buff, offset, out field.cityRealAiTimeRange))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 4, out field.cityRealAiTimeRandom))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 8, out field.cityRealAiTimeStep))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 12, out field.cityRealAiOutCityTimeRange))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 16, out field.cityRealAiOutCityTimeRandom))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 20, out field.cityRealAiOutCityTimeStep))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 24, out field.incity_npc_ai_buswait_time_default))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 28, out field.incity_npc_ai_downcar_num_limit))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 32, out field.incity_npc_ai_bushidetime_num_limit))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 36, out field.incity_npc_ai_incity_time))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 40, out field.incity_npc_ai_outcity_time))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 44, out field.incity_npc_ai_npcnum_buscallnow))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 48, out field.incity_npc_ai_starttodownpoint_time))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 52, out field.incity_npc_ai_downtouppoint_time))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 56, out field.city_operate_rubbish_pertime))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 60, out field.city_operate_rubbish_limit))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 64, out field.city_operate_rubbish_trigger_basepro))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 68, out field.city_operate_dispute_pertime))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 72, out field.city_operate_dispute_trigger_basepro))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 76, out field.city_operate_fix_pertime))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 80, out field.city_operate_fix_limit))
            {
                return false;
            }
            
            if(!UnPack(buff, offset + 84, out field.city_operate_fix_trigger_basepro))
            {
                return false;
            }
            
            return true;
        }
        
    }
}